﻿<Window x:Class="ResourceBlender_Express.WinOptions"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:loc="clr-namespace:ResourceBlender_Express"
    xmlns:validators="clr-namespace:ResourceBlender_Express.Validators"
    xmlns:props="clr-namespace:ResourceBlender_Express.Properties"
    loc:WindowService.EscapeClosesWindow="True"
    Title="Options"
    MinHeight="300" MinWidth="350"
    Height="380" Width="350" WindowStartupLocation="CenterOwner" 
    Style="{StaticResource {x:Type Window}}" Icon="/ResourceBlender-Express;component/Resources/images/resourceblender.ico">
    <Window.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Save" Executed="SaveSettings" />
        <CommandBinding Command="loc:ResourceBlenderCommands.ClearSettings" Executed="ClearSettings" />
    </Window.CommandBindings>
    <Window.Resources>
        <ResourceDictionary>
            <props:Settings x:Key="settings" />
        </ResourceDictionary>
    </Window.Resources>
    <DockPanel Margin="6" LastChildFill="true">
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" DockPanel.Dock="Bottom">
            <Button x:Name="btnSave" MinWidth="70" IsDefault="True" Command="ApplicationCommands.Save">Save</Button>
            <Button x:Name="btnCancel" MinWidth="70" IsCancel="True" Margin="2,2,0,2">Cancel</Button>
        </StackPanel>
        <TabControl Margin="6" DataContext="{StaticResource settings}" DockPanel.Dock="Top">
            <TabItem Header="Database">
                <loc:DatabaseSelector x:Name="databaseSelector" DataContext="{Binding}" />
            </TabItem>
            <TabItem Header="Preferences">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    
                    <Label Grid.Row="0" Grid.Column="0">Language</Label>
                    <ComboBox x:Name="cboLanguage" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" ItemTemplate="{StaticResource LanguageListItem}" SelectedValuePath="Key" SelectedValue="{Binding Path=Default.Language,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
                    
                    <Label Grid.Row="1" Grid.Column="0">AutoSave Interval</Label>
                    <TextBox x:Name="txtAutoSave" Grid.Row="1" Grid.Column="1" ToolTip="The delay between autosaves when autosave is enabled" Text="{Binding Path=Default.AutoSaveInterval,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
                    <Label Grid.Row="1" Grid.Column="2">ms</Label>
                    
                    <loc:ImageButton Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" MinWidth="140" Image="pack://application:,,,/Resources/images/eraser_16.png" ImageLocation="Left" Text="Clear Settings" Command="loc:ResourceBlenderCommands.ClearSettings" HorizontalAlignment="Center" />
                </Grid>
            </TabItem>
        </TabControl>
    </DockPanel>
</Window>
